Fix INJECT_FACTS_AS_VARS deprecation warning#152
Merged
tersmitten merged 1 commit intoOefenweb:masterfrom Jan 27, 2026
Merged
Conversation
3 tasks
There was a problem hiding this comment.
Pull request overview
This PR addresses Ansible 2.18 deprecation warnings by updating all references to facts from the deprecated direct variable access format (e.g., ansible_fqdn) to the recommended dictionary format (e.g., ansible_facts['fqdn']). This change ensures compatibility with future Ansible releases where the old format will become an error.
Changes:
- Updated virtualization fact references in task definitions to use the new dictionary format
- Updated hostname and domain fact references in default variables to use the new dictionary format
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tasks/main.yml | Updated virtualization_role and virtualization_type fact references to use ansible_facts dictionary |
| defaults/main.yml | Updated fqdn and domain fact references in postfix_hostname, postfix_mailname, and postfix_sasl_user variables to use ansible_facts dictionary |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ansible 2.18 deprecated accessing facts like `ansible_fqdn` directly, preferring `ansible_facts['fqdn']` instead. This will become an error in a future Ansible release. Updated fact references: - ansible_fqdn -> ansible_facts['fqdn'] - ansible_domain -> ansible_facts['domain'] - ansible_virtualization_role -> ansible_facts['virtualization_role'] - ansible_virtualization_type -> ansible_facts['virtualization_type'] See: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars
f7de388 to
1f21b34
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ansible 2.18 deprecated accessing facts like
ansible_fqdndirectly, preferringansible_facts['fqdn']instead. This will become an error in a future Ansible release.Updated fact references:
ansible_fqdn->ansible_facts['fqdn']ansible_domain->ansible_facts['domain']ansible_virtualization_role->ansible_facts['virtualization_role']ansible_virtualization_type->ansible_facts['virtualization_type']See: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars